package user

import (
	"context"
	"gitee.com/enjoy_5/user-rpc/internal/server/user"
	user2 "gitee.com/enjoy_5/user-rpc/proto/user"
)

type UserRevice struct {
	user2.UnimplementedUserServer
}

// 查询单条用户数据
func (u *UserRevice) Userfind(_ context.Context, req *user2.UserFirstRequest) (*user2.UserFirstResponse, error) {
	respon, err := user.UserFind(req)
	if err != nil {
		return nil, err
	}
	return respon, nil
}

// 用户新增
func (u *UserRevice) UserSave(_ context.Context, req *user2.SaveUserRequest) (*user2.SaveUserResponse, error) {
	respon, err := user.UserSave(req)
	if err != nil {
		return nil, err
	}
	return respon, nil
}

// 用户修改
func (u *UserRevice) UserUpdate(_ context.Context, req *user2.UpdUserRequest) (*user2.UpdUserResponse, error) {
	respon, err := user.UserUpdate(req)
	if err != nil {
		return nil, err
	}
	return respon, nil
}

// 用户列表
func (u *UserRevice) UserList(_ context.Context, req *user2.UserListRequest) (*user2.UserListResponse, error) {
	respon, err := user.UserList(req)
	if err != nil {
		return nil, err
	}
	return respon, nil
}
